package com.lrkj.payfee.service.impl;

import com.lrkj.common.utils.DateUtils;
import com.lrkj.common.utils.SecurityUtils;
import com.lrkj.common.utils.uuid.IdUtils;
import com.lrkj.payfee.domain.ChargeTime;
import com.lrkj.payfee.mapper.ChargeTimeMapper;
import com.lrkj.payfee.service.IChargeTimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 收费时间Service业务层处理
 *
 * @author yajun_ren
 * @date 2021-07-26
 */
@Service
public class ChargeTimeServiceImpl implements IChargeTimeService {
    @Autowired
    private ChargeTimeMapper chargeTimeMapper;

    /**
     * 查询收费时间
     *
     * @param chartimId 收费时间ID
     * @return 收费时间
     */
    @Override
    public ChargeTime selectChargeTimeById(String chartimId) {
        return chargeTimeMapper.selectChargeTimeById(chartimId);
    }

    /**
     * 查询收费时间列表
     *
     * @param chargeTime 收费时间
     * @return 收费时间
     */
    @Override
    public List<ChargeTime> selectChargeTimeList(ChargeTime chargeTime) {
        return chargeTimeMapper.selectChargeTimeList(chargeTime);
    }

    /**
     * 新增收费时间
     *
     * @param chargeTime 收费时间
     * @return 结果
     */
    @Override
    public int insertChargeTime(ChargeTime chargeTime) {
        chargeTime.setChartimId(IdUtils.simpleUUID());
        chargeTime.setCreateBy(SecurityUtils.getUsername());
        chargeTime.setCreateTime(DateUtils.getNowDate());
        return chargeTimeMapper.insertChargeTime(chargeTime);
    }

    /**
     * 修改收费时间
     *
     * @param chargeTime 收费时间
     * @return 结果
     */
    @Override
    public int updateChargeTime(ChargeTime chargeTime) {
        chargeTime.setUpdateBy(SecurityUtils.getUsername());
        chargeTime.setUpdateTime(DateUtils.getNowDate());
        return chargeTimeMapper.updateChargeTime(chargeTime);
    }

    /**
     * 批量删除收费时间
     *
     * @param chartimIds 需要删除的收费时间ID
     * @return 结果
     */
    @Override
    public int deleteChargeTimeByIds(String[] chartimIds) {
        return chargeTimeMapper.deleteChargeTimeByIds(chartimIds);
    }

    /**
     * 删除收费时间信息
     *
     * @param chartimId 收费时间ID
     * @return 结果
     */
    @Override
    public int deleteChargeTimeById(String chartimId) {
        return chargeTimeMapper.deleteChargeTimeById(chartimId);
    }
}
